_target = _this select 0;
_array = _this select 1;
_pos = if ((count _this) < 3) then {3} else {_this select 2};
_return = false;
if ((count _array) == 0) exitWith {_return = false};
{
    if (_target in _x) exitWith {_return = _x select _pos;};
} forEach _array; 

_return;